//
//  NSString+Extension.h
//  01-QQ聊天布局
//
//  Created by apple on 14-4-2.
//  Copyright (c) 2014年 itcast. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface NSString (Extension)
/**
 *  返回字符串所占用的尺寸
 *
 *  @param font    字体
 *  @param maxSize 最大尺寸
 */
- (CGSize)sizeWithFont:(UIFont *)font maxSize:(CGSize)maxSize;

- (CGSize)sizeWithText:(NSString *)text font:(UIFont *)font maxSize:(CGSize)maxSize;

- (CGSize)sizeWithAttributeText:(NSString *)text font:(UIFont *)font maxSize:(CGSize)maxSize andLineSpacing:(int)lineSpacing;
//获取字符串的高度
- (CGSize)sizeWithStringAndWidth:(CGFloat)width string:(NSString *)string font:(UIFont *)font;

- (CGFloat)getStringHeightWithText:(NSString *)text font:(UIFont *)font viewWidth:(CGFloat)width;

- (CGFloat)getWidthWithText:(NSString *)text height:(CGFloat)height font:(CGFloat)font;
//+(NSString *)getNowTimeTimestamp;
+(NSString*)getCurrentTimes;//现在的时间
+ (NSString *)getTimeAfterNowWithDay:(NSInteger)day;//当前时间的后几天
/**将某个时间转化成 时间戳*/
+ (NSInteger)timeSwitchTimestamp:(NSString *)formatTime andFormatter:(NSString *)format;
/**将某个时间戳转化成 时间*/
+ (NSString *)timestampSwitchTime:(NSInteger)timestamp andFormatter:(NSString *)format;
/**获取N天以后*/
+ (NSString *)timeBeforeInfoWithString:(NSString *)firstTime secondTime:(NSString *)secondTime;
/**
 **判断选择的两个日期是否冲突**
 */
+ (NSInteger)compareDate:(NSString*)stareDate withDate:(NSString*)endDate withFormat:(NSString *)format;
/**
 *计算两个日期相隔天数
 */
+ (NSInteger)getTimeDiffer:(NSString*)stareDate withDate:(NSString*)endDate withFormat:(NSString *)format;

/**获得当前时间戳 格式你定*/
+ (NSString *)getNowTimeTimestamp:(NSString *)format;
/**获得当前日期 格式你定*/
+ (NSString *)getNowDateWithFormat:(NSString *)format;
- (BOOL)isValidSixNumber;//6位提现密码
- (BOOL)isValidLoginNumber;//6-20位登陆密码
- (BOOL)isCorrect:(NSString *)IDNumber;//校验身份证号码
/**
 *  判断是不是手机号
 */
- (BOOL)isValidMobileNumber;
+ (BOOL)deptNumInputShouldNumber:(NSString *)str;

+ (BOOL)isEmptyText:(NSString*)text;//判断是否为空
+ (CGFloat)autoWidthWithString:(NSString *)string Font:(NSInteger)font ;
-(NSMutableAttributedString *)LineText:(NSString *)content;
+(NSString*)getTheCorrectNum:(NSString*)tempString;
+(NSString *)getDoubleValue:(double)doubleValue;
+(BOOL)isNUllString:(NSString *)string;
+ (NSString *)isChinese:(NSString *)str;
/**字典转json*/
+(NSString *)toJson:(NSDictionary *)dic;
/**字典或数组转json*/
+ (NSString *)toJSONData:(id)theData;
/**
 1. 可以输入整数
 2. 可以输入一位和两位小数
 3. 最多能输入一个小数点
 4. 整数部分避免出现001，032，这种情况

 金额输入限制：整数部分10位数，最多保留两位小数
 */
+ (BOOL)validateNumberNegativePoint:(NSString*)number;
/**
 获取首字母
 */
+(NSString *)getInitials:(NSString *)text;

// 显示--
+ (NSString *)stringWithNull:(NSString *)text;
/**只能输入字母加数字*/
+ (BOOL)numberAndLetter:(NSString*)text;
/**只能输入数字*/
+ (BOOL)numberOnly:(NSString*)text;
/**url编码 返回str*/
+ (NSString *)urlEncoding:(NSString *)url;
/**url编码 返回URL*/
+ (NSURL *)URLStrEncoding:(NSString *)url;
/**获取label文字的最佳宽度*/
+ (CGFloat)getLabelOptimumWidth:(UILabel *)label WithFont:(CGFloat)fontSize;
+(NSInteger )dateCompare:(NSString *)firstTime secondTime:(NSString *)secondTime;
+(void)callPhone:(NSString *)phone;
/**转换0.00元*/
+(NSString *)toTen:(NSString *)str;
/**转换0.0元*/
+(NSString *)toOne:(NSString *)str;
/**两个数相加*/
+ (NSString *)calculateByadding:(NSString *)number1 secondNumber:(NSString *)number2;
/**两个数相减*/
+(NSString *)calculateBySubtractingMinuend:(NSString *)number1 subtractorNumber:(NSString *)number2;
/**两个数相乘*/
+ (NSString *)calculateByMultiplying:(NSString *)number1 secondNumber:(NSString *)number2;
/**两个数相除*/
+ (NSString *)calculateByDividingNumber:(NSString *)number1 secondNumber:(NSString *)number2;
/**月:获取向前/向后日期*/
+(NSString *)getCustomDateFromDate:(NSDate *)date withMonth:(NSInteger)month;
/**日:获取向前/向后日期*/
+(NSString *)getCustomDateFromDate:(NSString *)date withDay:(NSInteger)day;
/**获取收款计划项*/
+(NSString *)getCollectionNameWithType:(NSInteger)type;
/**获取收款对应的id计划项*/
+(NSInteger)getCollectionTypeNameWithName:(NSString *)name;
+(CGFloat)remarksHeight:(NSString *)text;
/**
 * @brief 计算某两个时间差（得出秒数）
 */
- (long)numberOfSecondToTime:(NSString *)time2 FromTime:(NSString *)time1;
/**
 * 获取本周的开始日期和结束日期
 */
+ (NSArray *)getWeekBeginAndEndDate;
/**
 * 获取本周的开始日期和结束日期
 */
+ (NSArray *)getMonthBeginAndEndDate;

/**
 * 根据穿入的值获取数据
 * type : 1 - 获取id
 * type : 2 - 获取文字
 */
+(NSString *)getPaidNameWithFundType:(NSInteger)type;
/**
 * 根据收款类型获取收款类型名称
 */
+(NSString *)getCollectionNameWithFundType:(NSInteger)type;
/**
 * 根据付款类型获取付款类型名称
 */
+(NSInteger )getPaidFundTypeWithName:(NSString *)name;
/**
 * 删除 - 
 */
+ (NSString *)stringRemoveWithNull:(NSString *)text;
@end
